<template>
  <div class="box">
    <header class="more-header">
      <mt-header title="更多">
        <router-link to="/products" slot="left">
          <mt-button icon="back"></mt-button>
        </router-link>
        <mt-button class="iconfont icon-ai-search" slot="right"></mt-button>
      </mt-header>
    </header>
    <div class="more-content">
      <div class="more-left">
        <ul class="uls">
          <li @click="clean" id="clean">清洁</li>
          <li @click="feed" id="feed">喂养</li>
          <li @click="clothes" id="clothes">童装</li>
          <li @click="need" id="need">必备</li>
        </ul>
      </div>
      <div class="more-right">
        <ul>
          <li v-for="(item, index) in cleanlist" :key="index">
            <img :src="item.media" alt="">
            <p>{{item.proname}}</p>
            <span>会员价￥{{item.vprice}}</span>
          </li>
          <li @click="toDetail">
            <img src="./../../assets/baby1.jpg" alt="">
            <p>1233</p>
            <span>会员价￥100</span>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
import Qs from 'qs'
import Vue from 'vue'
import { Search } from 'mint-ui'
Vue.component(Search.name, Search)
export default {
  data () {
    return {
      cleanlist: []
    }
  },
  methods: {
    clean () {
      let cleans = document.getElementById('clean')
      cleans.style.background = '#ACEBDB'
      let data1 = {
        token: '7qwN83Y2xI2xasQikfLHvwFwLQKxxk5wZyi6Ej+So2Vx1864is3FP2c+zr18HzNAC7fzHZHbmLDWwJraATqJ+cjyp9aSekyCKPoiVit0kHqEJYNu3/HhVAqSW1YJBo9GtG4aH2RSdJ194HC4Slo8wLMBKgvd61ZSGeyJJ80HEnPtUff6/csmpBFsSlXoVRN+DygYwJsRRi2im1HkL0zDJr9GL1nJSxfJLr2+3dEGuEGyDJYuS6aGVaSzY7BCGX2OBspUNJw5BuYR/t3hvUWPCYbfCSehfNHALihJVTJ39LLJ9d/uyc4ciyBA5ZbusTst',
        tid: 1,
        pageNum: 1,
        pageSize: 5
      }
      // 商品区
      axios({
        method: 'post',
        url: 'http://10.8.162.3:8081/productbytid.do',
        data: Qs.stringify(data1)
      })
        .then((res) => {
          console.log(res)
          const obj = res.data.list
          this.cleanlist = obj
          console.log(this.cleanlist)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    feed () {
      let feeds = document.getElementById('feed')
      feeds.style.background = '#ACEBDB'
      let data2 = {
        token: '7qwN83Y2xI2xasQikfLHvwFwLQKxxk5wZyi6Ej+So2Vx1864is3FP2c+zr18HzNAC7fzHZHbmLDWwJraATqJ+cjyp9aSekyCKPoiVit0kHqEJYNu3/HhVAqSW1YJBo9GtG4aH2RSdJ194HC4Slo8wLMBKgvd61ZSGeyJJ80HEnPtUff6/csmpBFsSlXoVRN+DygYwJsRRi2im1HkL0zDJr9GL1nJSxfJLr2+3dEGuEGyDJYuS6aGVaSzY7BCGX2OBspUNJw5BuYR/t3hvUWPCYbfCSehfNHALihJVTJ39LLJ9d/uyc4ciyBA5ZbusTst',
        tid: 2,
        pageNum: 1,
        pageSize: 5
      }
      // 商品区
      axios({
        method: 'post',
        url: 'http://10.8.162.3:8081/productbytid.do',
        data: Qs.stringify(data2)
      })
        .then((res) => {
          console.log(res)
          const obj = res.data.list
          this.cleanlist = obj
          console.log(this.cleanlist)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    clothes () {
      let cleans = document.getElementById('clothes')
      cleans.style.background = '#ACEBDB'
      let data3 = {
        token: '7qwN83Y2xI2xasQikfLHvwFwLQKxxk5wZyi6Ej+So2Vx1864is3FP2c+zr18HzNAC7fzHZHbmLDWwJraATqJ+cjyp9aSekyCKPoiVit0kHqEJYNu3/HhVAqSW1YJBo9GtG4aH2RSdJ194HC4Slo8wLMBKgvd61ZSGeyJJ80HEnPtUff6/csmpBFsSlXoVRN+DygYwJsRRi2im1HkL0zDJr9GL1nJSxfJLr2+3dEGuEGyDJYuS6aGVaSzY7BCGX2OBspUNJw5BuYR/t3hvUWPCYbfCSehfNHALihJVTJ39LLJ9d/uyc4ciyBA5ZbusTst',
        tid: 3,
        pageNum: 1,
        pageSize: 5
      }
      // 商品区
      axios({
        method: 'post',
        url: 'http://10.8.162.3:8081/productbytid.do',
        data: Qs.stringify(data3)
      })
        .then((res) => {
          console.log(res)
          const obj = res.data.list
          this.cleanlist = obj
          console.log(this.cleanlist)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    need () {
      let cleans = document.getElementById('need')
      cleans.style.background = '#ACEBDB'
      let data4 = {
        token: '7qwN83Y2xI2xasQikfLHvwFwLQKxxk5wZyi6Ej+So2Vx1864is3FP2c+zr18HzNAC7fzHZHbmLDWwJraATqJ+cjyp9aSekyCKPoiVit0kHqEJYNu3/HhVAqSW1YJBo9GtG4aH2RSdJ194HC4Slo8wLMBKgvd61ZSGeyJJ80HEnPtUff6/csmpBFsSlXoVRN+DygYwJsRRi2im1HkL0zDJr9GL1nJSxfJLr2+3dEGuEGyDJYuS6aGVaSzY7BCGX2OBspUNJw5BuYR/t3hvUWPCYbfCSehfNHALihJVTJ39LLJ9d/uyc4ciyBA5ZbusTst',
        tid: 4,
        pageNum: 1,
        pageSize: 5
      }
      // 商品区
      axios({
        method: 'post',
        url: 'http://47.99.223.44:8081/productbytid.do',
        data: Qs.stringify(data4)
      })
        .then((res) => {
          console.log(res)
          const obj = res.data.list
          this.cleanlist = obj
          console.log(this.cleanlist)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    toDetail () {
      this.$router.push('/prodetail')
    }
  }
}
</script>

<style lang="scss">
@import '@/lib/reset.scss';
.more-header {
  @include rect(100%, 0.4rem);
  text-align: center;
  box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 1);
  font-family: Arial;
  border: 1px solid rgba(255, 255, 255, 0);
  border: none;
  .mint-header {
    height: 100%;
    background-color: #ACEBDB;
    h1, .mint-header-button{
      color: rgba(100, 100, 100, 1);
      font-size: 0.16rem;
      .mintui-back {
        font-weight: 900;
      }
    }
  }
}
.more-content {
  @include rect(100%, 100%);
  .more-left {
    float: left;
    @include rect(18%, 100%);
    border-right: 1px solid #b9b9b9;
    background: rgb(243, 242, 242);
    ul {
      padding-top: 0.1rem;
      li {
        width: 100%;
        line-height: 0.3rem;
        font-size: 0.14rem;
        text-align: center;
        margin-top: 0.05rem;
        i {
          font-size: 0.13rem;
          color: rgb(125, 128, 127)
        }
      }
    }
  }
  .more-right {
    float: right;
    @include rect(80%, auto);
    ul {
      li {
        margin-top: 0.1rem;
        margin-left: 0.19rem;
        margin-bottom: 0.05rem;
        float: left;
        img {
          @include rect(1.2rem, 1.2rem);
          border-radius: 0.08rem;
        }
        p {
          margin-top: 0.05rem;
          width: 1.2rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
        span {
          font-size: 0.12rem;
          color: rgb(228, 57, 57);
        }
      }
    }
  }
}
</style>
